package Level02_four;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;

public class Test {
    public static void main(String[] args) {
        String arr[]={"abc","bad","abc","aab","bad","cef","jhi"};
        ArrayList<Object> arrayList = new ArrayList<>();
        arrayList.addAll(Arrays.asList(arr));
        HashSet<Object> hashSet = new HashSet<>();
        // 将ArrayList中的元素添加到HashSet中
        hashSet.addAll(arrayList);
        // 清空ArrayList
        arrayList.clear();
        // 将HashSet中的元素添加到ArrayList中
        arrayList.addAll(hashSet);
        // 输出ArrayList
        System.out.println(arrayList);
    }
}
